package com.governtalk.backend.service;

import com.governtalk.backend.dto.wrongquestion.WrongQuestionDto;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.List;
import java.util.Map;

public interface WrongQuestionService {
    
    /**
     * 添加错题到错题本
     */
    WrongQuestionDto addWrongQuestion(WrongQuestionDto wrongQuestionDto);
    
    /**
     * 批量添加错题到错题本
     */
    List<WrongQuestionDto> addWrongQuestions(List<WrongQuestionDto> wrongQuestionDtos);
    
    /**
     * 根据用户ID分页查询错题
     */
    Page<WrongQuestionDto> getWrongQuestionsByUserId(Long userId, Pageable pageable);
    
    /**
     * 根据用户ID查询所有错题
     */
    List<WrongQuestionDto> getAllWrongQuestionsByUserId(Long userId);
    
    /**
     * 根据用户ID和关键词搜索错题
     */
    Page<WrongQuestionDto> searchWrongQuestions(Long userId, String keyword, Pageable pageable);
    
    /**
     * 根据用户ID和题型查询错题
     */
    Page<WrongQuestionDto> getWrongQuestionsByType(Long userId, String type, Pageable pageable);
    
    /**
     * 根据用户ID和题目分类查询错题
     */
    Page<WrongQuestionDto> getWrongQuestionsByCategory(Long userId, Long categoryId, Pageable pageable);
    
    /**
     * 根据用户ID和复习状态查询错题
     */
    Page<WrongQuestionDto> getWrongQuestionsByReviewStatus(Long userId, Boolean isReviewed, Pageable pageable);
    
    /**
     * 更新错题信息
     */
    WrongQuestionDto updateWrongQuestion(Long id, WrongQuestionDto wrongQuestionDto);
    
    /**
     * 更新复习状态
     */
    WrongQuestionDto updateReviewStatus(Long id, Boolean isReviewed, Integer masteryLevel);
    
    /**
     * 更新错误原因
     */
    WrongQuestionDto updateErrorReason(Long id, String errorReason);
    
    /**
     * 更新复习笔记
     */
    WrongQuestionDto updateReviewNotes(Long id, String reviewNotes);
    
    /**
     * 删除错题
     */
    void deleteWrongQuestion(Long id);
    
    /**
     * 批量删除错题
     */
    void deleteWrongQuestions(List<Long> ids);
    
    /**
     * 清空用户错题本
     */
    void clearWrongQuestions(Long userId);
    
    /**
     * 获取错题统计信息
     */
    Map<String, Object> getWrongQuestionStats(Long userId);
    
    /**
     * 检查题目是否已在错题本中
     */
    boolean isQuestionInWrongBook(Long userId, Long questionId);
}
